# -*- coding: UTF-8 -*- #
"""
-------真正的勇士， 敢于直面惨淡的Warning、 敢于正视淋漓的Error-----
@author : 贾鹏博
@file : search_page.py
@time : 2022/6/11 17:29
"""

from appium.webdriver.common.appiumby import AppiumBy
from apptest.XueQiu_PO.page.search_result_page import SearchResultPage
from apptest.XueQiu_PO.base.xueqiu_app import XueQiuApp


class SearchPage(XueQiuApp):

    def input_searchcontent(self, searchkey):
        # 输入搜索内容
        self.find_and_send(AppiumBy.ID, "com.xueqiu.android:id/search_input_text", searchkey)
        return self

    def click_searchresult(self, text):
        # 点击搜索结果   ->   阿里巴巴  点击包含 text 内容
        self.find_and_click(AppiumBy.XPATH, f"//*[@text='{text}']")
        return SearchResultPage(self.driver)
